package com.wordlearning.app.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;

@Data
@TableName("word_sets")
public class WordSet {

    @TableId(type = IdType.AUTO)
    private Long id;

    private String name;

    private String description;

    @TableField("user_id")
    private Long userId = 1L; // 默认用户ID

    // MyBatis-Plus不直接支持多对多关联
    // 需要在Service层手动处理关联关系
    @TableField(exist = false)
    private List<Word> words;

    @TableField("created_at")
    private LocalDateTime createdAt;

    @TableField("updated_at")
    private LocalDateTime updatedAt;
    
    // MyBatis-Plus自动填充功能，通过MyMetaObjectHandler实现
    // 不需要手动实现@PrePersist和@PreUpdate方法
}